<<<<<<< HEAD
  package course.view;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.Iterator;
import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.table.DefaultTableModel;
import course.controller.CourseControllerListener;
import course.po.Dean;
import course.po.Student;
import course.service.impl.CourseServiceImpl;

public class DeanFrame extends JFrame {
	private static final long serialVersionUID = 1L;
	private CourseControllerListener controllerListener;
	private JScrollPane tablePanel;
	public CourseServiceImpl courseService;
	public JPanel p1;
	public JPanel p2;
	public JPanel p3;
	public JPanel p4;
	public static int isbn = -1;
	public static JTabbedPane jTabbedPane;
	public DeanFrame() {
		this.controllerListener = new CourseControllerListener();
		this.controllerListener.setDeanFrame(this);
		this.setTitle("教务员管理系统");
		this.setJMenuBar(getDeanMenuBar());
		p1 = new DeanJPanel();
		p3 = new TeacherJPanel();
		p2 = new StudentJPanel();
		p4 = new DJPanel();
		jTabbedPane=this.buildJTabbedPane(p4,p1, p3, p2);
		this.add(jTabbedPane);
		this.setSize(1095, 835);
		this.setResizable(true);
		this.setLocationRelativeTo(null);
		this.validate();
		this.setVisible(true);
	}

	// 显示教师、学生、教务员的选项卡面板
	private JTabbedPane buildJTabbedPane(JPanel dJPanel,JPanel deaPanel, JPanel teaPanel,JPanel stuPanel ) {
		// 选项卡面板
		JTabbedPane tabbedPane = new JTabbedPane();
		// 通过BorderFactory来设置边框的特性
		tabbedPane.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15));
		tabbedPane.add("教务员详细信息", dJPanel);
		tabbedPane.add("教务员信息", deaPanel);
		tabbedPane.add("学生信息", stuPanel);
		tabbedPane.add("教师信息", teaPanel);
		return tabbedPane;
	}

	// 教务员界面
	public JMenuBar getDeanMenuBar() {
	
		JMenuItem deanMenuItem = new JMenuItem("教务员信息管理");
		ImageIcon deanMenuItemIcon = new ImageIcon(DeanFrame.class.getResource("/dean.png"));
		deanMenuItem.setIcon(deanMenuItemIcon);
		JMenuItem studentMenuItem = new JMenuItem("学生信息管理");
		ImageIcon studentMenuItemIcon = new ImageIcon(DeanFrame.class.getResource("/student.png"));
		studentMenuItem.setIcon(studentMenuItemIcon);
		JMenuItem teacherMenuItem = new JMenuItem("教师信息管理");
		ImageIcon teacherMenuItemIcon = new ImageIcon(DeanFrame.class.getResource("/teacher.png"));
		teacherMenuItem.setIcon(teacherMenuItemIcon);
		JMenuItem courseMenuItem = new JMenuItem("课程管理");
		ImageIcon courseMenuItemIcon = new ImageIcon(DeanFrame.class.getResource("/course.png"));
		studentMenuItem.setIcon(courseMenuItemIcon);
		JMenuItem goMenuItem = new JMenuItem("退出系统");
//		ImageIcon goMenuItemIcon = new ImageIcon(DeanFrame.class.getResource("/course.png"));
//		goMenuItem.setIcon(courseMenuItemIcon);
	
		deanMenuItem.addActionListener(controllerListener);
		deanMenuItem.setActionCommand("refreshDeanFrame");
		studentMenuItem.addActionListener(controllerListener);
		studentMenuItem.setActionCommand("refreshStudentFrame");
		teacherMenuItem.addActionListener(controllerListener);
		teacherMenuItem.setActionCommand("refreshTeacherFrame");
		courseMenuItem.addActionListener(controllerListener);
		courseMenuItem.setActionCommand("course");
		goMenuItem.addActionListener(controllerListener);
		goMenuItem.setActionCommand("gobackD");
		JMenuBar bar = new JMenuBar();
		JMenu fileMenu = new JMenu("管理员功能");
		fileMenu.add(deanMenuItem);
		fileMenu.add(studentMenuItem);
		fileMenu.add(teacherMenuItem);
		fileMenu.add(courseMenuItem);
		fileMenu.add(goMenuItem);
		
		bar.add(fileMenu);
		return bar;
=======
package course.view;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.Iterator;
import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.table.DefaultTableModel;
import course.controller.CourseControllerListener;
import course.po.Dean;

public class DeanFrame extends JFrame {
	private static final long serialVersionUID = 1L;
	private CourseControllerListener controllerListener;
	private JScrollPane tablePanel;
	public JPanel p1;
	public JPanel p2;
	public JPanel p3;
	public static int isbn = -1;

	public DeanFrame() {
		this.controllerListener = new CourseControllerListener();
		this.controllerListener.setDeanFrame(this);
		this.setTitle("教务员管理系统");
		this.setJMenuBar(getDeanMenuBar());
		p1 = new DeanJPanel();
		p3 = new TeacherJPanel();
		p2 = new StudentJPanel();
		this.add(this.buildJTabbedPane(p1, p2, p3));
		this.setSize(1095, 835);
		this.setResizable(true);
		this.setLocationRelativeTo(null);
		this.validate();
		this.setVisible(true);
	}

	// 显示教师、学生、教务员的选项卡面板
	private JTabbedPane buildJTabbedPane(JPanel deaPanel, JPanel stuPanel, JPanel teaPanel) {
		// 选项卡面板
		JTabbedPane tabbedPane = new JTabbedPane();
		// 通过BorderFactory来设置边框的特性
		tabbedPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
		tabbedPane.add("教务员信息", deaPanel);
		tabbedPane.add("学生信息", stuPanel);
		tabbedPane.add("教师信息", teaPanel);
		return tabbedPane;
	}

	// 教务员界面
	public JMenuBar getDeanMenuBar() {
		JMenuItem deanMenuItem = new JMenuItem("教务员信息管理");
		ImageIcon deanMenuItemIcon = new ImageIcon(DeanFrame.class.getResource("/dean.png"));
		deanMenuItem.setIcon(deanMenuItemIcon);
		JMenuItem studentMenuItem = new JMenuItem("学生信息管理");
		ImageIcon studentMenuItemIcon = new ImageIcon(DeanFrame.class.getResource("/student.png"));
		studentMenuItem.setIcon(studentMenuItemIcon);
		JMenuItem teacherMenuItem = new JMenuItem("教师信息管理");
		ImageIcon teacherMenuItemIcon = new ImageIcon(DeanFrame.class.getResource("/teacher.png"));
		teacherMenuItem.setIcon(teacherMenuItemIcon);
		JMenuItem courseMenuItem = new JMenuItem("课程管理");
		ImageIcon courseMenuItemIcon = new ImageIcon(DeanFrame.class.getResource("/course.png"));
		studentMenuItem.setIcon(courseMenuItemIcon);
		deanMenuItem.addActionListener(controllerListener);
		deanMenuItem.setActionCommand("refreshDeanFrame");
		studentMenuItem.addActionListener(controllerListener);
		studentMenuItem.setActionCommand("refreshStudentFrame");
		teacherMenuItem.addActionListener(controllerListener);
		teacherMenuItem.setActionCommand("refreshTeacherFrame");
		courseMenuItem.addActionListener(controllerListener);
		courseMenuItem.setActionCommand("course");
		JMenuBar bar = new JMenuBar();
		JMenu fileMenu = new JMenu("管理员功能");
		fileMenu.add(deanMenuItem);
		fileMenu.add(studentMenuItem);
		fileMenu.add(teacherMenuItem);
		fileMenu.add(courseMenuItem);
		bar.add(fileMenu);
		return bar;
	}

	// 教务员表单数据
	private JScrollPane getDeanTablePanel(List<Dean> deanList) {
		String titles[] = { "编号", "教职工号", "姓名", "性别", "年龄" };
		Object[][] data = new Object[deanList.size()][5];
		Iterator<Dean> iter = deanList.iterator();
		int i = 0;
		while (iter.hasNext()) {
			Dean dean = iter.next();
			data[i][0] = dean.getDeaId();
			data[i][1] = dean.getDeaNo();
			data[i][2] = dean.getDeaName();
			data[i][3] = dean.getDeaSex();
			data[i][4] = dean.getDeaAge();
			i++;
		}
		DefaultTableModel tableModel = new DefaultTableModel(data, titles);
		JTable table = new JTable(tableModel);
		table.getTableHeader().setBackground(Color.orange); // 表头颜色
		table.getTableHeader().setFont(new Font("微软雅黑", Font.BOLD, 17)); // 表头字体
		table.setFont(new Font("微软雅黑", Font.PLAIN, 25)); // 表体字体
		table.setBackground(Color.pink); // 表体颜色
		table.getTableHeader().setPreferredSize(new Dimension(1, 30)); // 表头高度
		table.setRowHeight(table.getRowHeight() + 15); // 表体高度
		table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // 表格只能选择一行
		table.repaint();
		table.addMouseListener(new MouseAdapter() {
			public void mouseClicked(final MouseEvent e) {
				isbn = table.getSelectedRow(); // 得到选中的行
			}
		});
		tablePanel = new JScrollPane(table);
		return tablePanel;
>>>>>>> refs/remotes/origin/master
	}

	public CourseControllerListener getControllerListener() {

		return controllerListener;
	}

	public int getDeanIsbn() {
		return isbn;
	}

	public int getStudentIsbn() {
		return StudentFrame.isbn;
	}

	public int getTeacherIsbn() {
		return TeacherFrame.isbn;
	}

}